//
//  BKMyCommon.m
//  bestkeep
//
//  Created by 武探 on 2016/11/3.
//  Copyright © 2016年 utouu. All rights reserved.
//

#import "BKMyCommon.h"
#import "BKUserStatusInfo.h"
#import "BKUserLoginController.h"
#import "BKUserNavigationBarCustomViewController.h"
NSString * const BKMyLocalizableTableName = @"BKMyLocalizable";

@implementation BKMyCommon

+(NSString *)localizedStringWithKey:(NSString *)key {
    return NSLocalizedStringFromTable(key, BKMyLocalizableTableName, nil);
}

+(BOOL)userIsLoginWithInController:(UIViewController *)controller
{
    BKUserStatusInfo * userInfo = [BKUserStatusInfo currentUser];
    if (userInfo.isLogin) {
        
        return YES;
    } else {
        
        BKUserLoginController * LoginvVC = [BKUserLoginController userGotoLoginWithBlcok:^() {
        }];
        
        BKUserNavigationBarCustomViewController * navc = [[BKUserNavigationBarCustomViewController alloc]initWithRootViewController:LoginvVC];
        [controller presentViewController:navc animated:YES completion:nil];
    }
    return NO;
}

+(BOOL)checkNetwork
{
    NSInteger numbe = [RequestManager reachabilityStatus];
    NSLog(@"网络状态-----%ld",(long)numbe);
    if ([RequestManager reachabilityStatus] == AFNetworkReachabilityStatusReachableViaWiFi ) {
        return YES;
    }else if ([RequestManager reachabilityStatus] == RequestReachabilityStatusReachableViaWWAN){
        return YES;
    }else if ([RequestManager reachabilityStatus] == RequestReachabilityStatusNotReachable){
        return NO;
    }else{
        return NO;
    }
}


@end
